#include "Control.h"

char key;//	��� ����� ���� ������� � ����������
char keep_direct;//	��� ���������� �������  ����������� ��������.
//int _getch(void);// �������� ������ �� ������� ��� �����������

int main()
{
	std::cout << "Press any key" << std::endl;

	do
	{
		key = _getch();
		if (key == 0 || key == -32) 
		{
			keep_direct = _getch();

			switch (keep_direct)
			{
			case up: {std::cout << "up" << std::endl; }
				   break;
			case down: {std::cout << "down" << std::endl; }
					 break;
			case left: {std::cout << "left" << std::endl; }
					 break;
			case right: {std::cout << "right" << std::endl; }
					  break;
			default: {std::cout << "err404" << std::endl; }
			}
		}
		else
		{
			switch (key = toupper(key))
			{
			case 'D': {std::cout << "right" << std::endl;}
					break;
			case 'A': {std::cout << "left" << std::endl;}
					break;
			case 'W': {std::cout << "up" << std::endl;}
					break;
			case 'S': {std::cout << "down" << std::endl;}
					break;
			case '0':
			case esc: {std::cout << "out" << std::endl;}
					break;

			default: {std::cout << "err" << std::endl;}
			}
		}
	} while (key != esc && key != '0');

	return 0;//��� ���������� ����������
}
